-- CALC_GOLDEN_EGG_DROP

-- 金蛋掉落
return function(emptyList, minePos)
    -- 随机点击10~20下后，金蛋爆开，地上随机掉落以下物品，最多20堆
    -- 5~6堆 红包×1
    -- 2~4堆 遗迹碎片×500
    -- 3~7堆 1、2阶阶矿×5
    -- 3~7堆 1、2阶食材×5
    -- 3~7堆 冒险者、战士、法师遗物×1
    emptyList = sortRecentDungeonPos(minePos, emptyList);
    local ret   = {};
    local bonus = {};
    local rand;

    local arr1     = { 5, 2, 3, 3, 3 };
    local arr2     = { 2, 3, 5, 5, 5 };
    local material = { 1102, 1103, 1104, 1105 };
    local foods    = { 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308 };
    local relics   = { 6000, 6010, 6020 };

    local index = 0;
    for n = 1, 5 do
        rand = DungeonM.getRandSeed("CALC_GOLDEN_EGG_DROP") % arr2[n] + arr1[n];
        for i = 1, rand do
            if n == 1 then
                table.insert(bonus, {1, 1514, 1});
            elseif n == 2 then
                table.insert(bonus, {1, 10000, 500});
            elseif n == 3 then
                index = DungeonM.getRandSeed("CALC_GOLDEN_EGG_DROP") % #material + 1;
                table.insert(bonus, {1, material[index], 5});
            elseif n == 4 then
                index = DungeonM.getRandSeed("CALC_GOLDEN_EGG_DROP") % #foods + 1;
                table.insert(bonus, {1, foods[index], 5});
            else
                index = DungeonM.getRandSeed("CALC_GOLDEN_EGG_DROP") % #relics + 1;
                table.insert(bonus, {1, relics[index], 1});
            end
        end
    end

    local dropNum = math.min(#emptyList, #bonus, 20);
    for i = 1, dropNum do
        ret[emptyList[i]] = bonus[i];
    end

    return ret;
end